package com;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;

public class _02_TCPClient {

	public static void main(String[] args) throws Exception {

		// 创建连接,需要传入IP和端口
		Socket skt = new Socket("127.0.0.1", 10000);
		// 获取流 向服务端发送数据
		PrintWriter out = new PrintWriter(new OutputStreamWriter(skt.getOutputStream(), "gbk"));

		out.println("啥也不是");
		out.flush();

		// 获取输入流,接收服务端返回的数据
		InputStream fis = skt.getInputStream();
		BufferedReader br = new BufferedReader(new InputStreamReader(fis, "gbk"));
		System.out.println(br.readLine());

		br.close();
		out.close();
		skt.close();
	}
}
